package za.co.yellowfire.solarflare;

import java.io.Serializable;

/**
 * @author Mark P Ashworth
 * @version 0.0.1
 */
public class SearchQuery implements Serializable {
    private static final long serialVersionUID = 1L;

    private Class domainClass;
    private String query;
    private String filter;
    private String fields;
    private boolean debug;
    private boolean facetOn;
    private QueryOperator operator = QueryOperator.OR;

    /**
     * Default constructor
     */
    public SearchQuery() {}

    public SearchQuery(Class domainClass, String query) {
        this.domainClass = domainClass;
        this.query = query;
    }

    public Class getDomainClass() {
        return domainClass;
    }

    public void setDomainClass(Class domainClass) {
        this.domainClass = domainClass;
    }

    public String getQuery() {
        return query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    public String getFilter() {
        return filter;
    }

    public void setFilter(String filter) {
        this.filter = filter;
    }

    public String getFields() {
        return fields;
    }

    public void setFields(String fields) {
        this.fields = fields;
    }

    /**
     * Turns debugging Solr on|off
     * @return Whether debugging is on|off
     */
    public boolean isDebug() {
        return debug;
    }

    /**
     * Turns debugging Solr on|off
     * @param debug The new value
     */
    public void setDebug(boolean debug) {
        this.debug = debug;
    }

    public boolean isFacetOn() {
        return facetOn;
    }

    public void setFacetOn(boolean facetOn) {
        this.facetOn = facetOn;
    }

    /**
     * Whether the search query terms should be AND-ed or OR-ed togther
     * @return The query operator, either AND or OR
     */
    public QueryOperator getOperator() {
        return operator;
    }

    /**
     * Whether the search query terms should be AND-ed or OR-ed togther
     * @param operator The new query operator, either AND or OR
     */
    public void setOperator(QueryOperator operator) {
        this.operator = operator;
    }
}
